home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Autosize
- AutoRedraw = -1 'True
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "Autosize"
- ClientHeight = 3810
- ClientLeft = 2025
- ClientTop = 1830
- ClientWidth = 4470
- Height = 4215
- Left = 1965
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- ScaleHeight = 3810
- ScaleWidth = 4470
- Top = 1485
- Width = 4590
- Begin Frame frmEd
- Caption = "frmEd"
- Height = 735
- Left = 1200
- TabIndex = 2
- Top = 2640
- Width = 1575
- Begin OptionButton opt
- Caption = "Opt"
- Height = 255
- Index = 0
- Left = 360
- TabIndex = 3
- Top = 360
- Width = 855
- End
- End
- Begin ListBox lst
- Height = 810
- Index = 0
- Left = 1200
- TabIndex = 5
- Top = 1680
- Width = 2295
- End
- Begin ComboBox cbo
- Height = 300
- Index = 0
- Left = 1200
- Style = 2 'Dropdown List
- TabIndex = 4
- Top = 1200
- Width = 2295
- End
- Begin TextBox txt
- Height = 375
- Index = 0
- Left = 1200
- TabIndex = 0
- Top = 720
- Width = 1215
- End
- Begin CommandButton cmd
- Caption = "cmd"
- Height = 495
- Index = 0
- Left = 1200
- TabIndex = 1
- TabStop = 0 'False
- Top = 120
- Width = 1215
- End
- Sub cmd_Click (Index As Integer)
- Unload Autosize
- End Sub
- Sub DrawForm ()
- '---Set textout alignment...
- Result% = SetTextAlign(Autosize.hDC, TA_BOTTOM + TA_RIGHT)
- '---Label 1...
- SetFont 1, Autosize
- Lbl$ = "Name: "
- X% = txt(0).Left
- Y% = txt(0).Top + txt(0).Height
- Result% = TextOut(Autosize.hDC, X%, Y%, Lbl$, Len(Lbl$))
- '---Label 2...
- Lbl$ = "Address: "
- Y% = txt(1).Top + txt(1).Height
- Result% = TextOut(Autosize.hDC, X%, Y%, Lbl$, Len(Lbl$))
- '---Label 3...
- Lbl$ = "City, State & Zip: "
- Y% = txt(2).Top + txt(2).Height
- Result% = TextOut(Autosize.hDC, X%, Y%, Lbl$, Len(Lbl$))
- '---Label 4...
- Lbl$ = "Division: "
- Y% = cbo(0).Top + cbo(0).Height
- Result% = TextOut(Autosize.hDC, X%, Y%, Lbl$, Len(Lbl$))
- '---Label 5...
- Lbl$ = "Department: "
- Y% = lst(0).Top + txt(0).Height
- Result% = TextOut(Autosize.hDC, X%, Y%, Lbl$, Len(Lbl$))
- End Sub
- Sub Form_Load ()
- Screen.MousePointer = 11
- Refresh
- Init_Measures Autosize
- MakeForm
- DrawForm
- PrimeCtls
- Screen.MousePointer = 0
- End Sub
- Sub MakeForm ()
- '---------------------------------------------------------
- ' Size & Position your controls. Start in the upper
- ' left of your form and work your way to the lower right.
- '---------------------------------------------------------
- '---------------------------------------------------
- ' Create 2 additional Text boxes...
- '---------------------------------------------------
- For I% = 1 To 2
- Load txt(I%)
- txt(I%).Visible = -1
- Next
- '---------------------------------------------------
- ' Move the highest textbox...
- ' The left position of the textboxes will be the
- ' width of the widest label printed on the form
- ' PLUS 2 Std character widths. Its' top will be 2
- ' Std character heights from the top of the form.
- '---------------------------------------------------
- SetFont 1, Autosize
- TheLft% = TextWidth("City, State & Zip: ") + 2 * gHStd
- TheTop% = 2 * gVStd
- '---Move is MUCH faster than setting the LEFT, TOP, WIDTH & HEIGHT properties.
- txt(0).Move TheLft%, TheTop%, 25 * gHStd, gVStd
- '---------------------------------------------------
- ' Align the second textbox under the first...
- '---------------------------------------------------
- TheTop% = TheTop% + txt(0).Height + .5 * gVStd
- txt(1).Move TheLft%, TheTop%, 25 * gHStd, gVStd
- '---------------------------------------------------
- ' Align the third textbox under the second...
- '---------------------------------------------------
- TheTop% = TheTop% + txt(0).Height + .5 * gVStd
- txt(2).Move TheLft%, TheTop%, 25 * gHStd, gVStd
- '---------------------------------------------------
- ' Align the combo box under the last textbox...
- '---------------------------------------------------
- TheTop% = TheTop% + txt(0).Height + .5 * gVStd
- cbo(0).Move TheLft%, TheTop%, 25 * gHStd
- '---------------------------------------------------
- ' Align the listbox under the combo box...
- ' Make it 4 lines high.
- '---------------------------------------------------
- TheTop% = TheTop% + cbo(0).Height + .5 * gVStd
- lst(0).Move TheLft%, TheTop%, 25 * gHStd, 4 * gVStd
- '---------------------------------------------------
- ' Size & Position option Frame...
- ' Align the bottom of the frame with the bottom of
- ' the listbox. Put it 2 std character widths from
- ' the right of the listbox.
- '---------------------------------------------------
- frmEd.Caption = "Education"
- TheWth% = 15 * gHStd
- TheHgt% = 6 * gVStd
- TheLft% = lst(0).Left + lst(0).width + 2 * gHStd
- TheTop% = lst(0).Top + lst(0).Height - TheHgt%
- frmEd.Move TheLft%, TheTop%, TheWth%, TheHgt%
- '---------------------------------------------------
- ' Option buttons...
- ' These are positioned relative to the walls of its
- ' container (frame). Since the scalemode of a frame
- ' is always in Twips, we must use our gTwpsPerPxlX
- ' and gTwpsPerPxlY global variables to multiply by.
- '---------------------------------------------------
- '---Load an additional option button, set properties...
- Load opt(1)
- opt(1).Visible = -1
- opt(1).Caption = "College"
- opt(0).Caption = "High School"
- '---position & Size option buttons...
- TheTop% = 2 * gVStd * gTwpsPerPxlY
- TheLft% = 2 * gHStd * gTwpsPerPxlX
- TheWth% = 12 * gHStd * gTwpsPerPxlX
- TheHgt% = 1.5 * gVStd * gTwpsPerPxlY
- opt(0).Move TheLft%, TheTop%, TheWth%, TheHgt%
- opt(1).Move TheLft%, opt(0).Top + opt(0).Height, TheWth%, TheHgt%
- '-------------------------------------------------------
- ' Create required Command buttons and position them...
- '-------------------------------------------------------
- Load cmd(1)
- cmd(1).Visible = -1
- cmd(1).Cancel = -1
- cmd(1).Caption = "Cancel"
- cmd(0).Default = -1
- cmd(0).Caption = "OK"
- cmd(0).Move frmEd.Left + frmEd.width - 9 * gHStd%, txt(0).Top, 9 * gHStd, 1.85 * gVStd
- cmd(1).Move cmd(0).Left, cmd(0).Top + 2.5 * gVStd, 9 * gHStd, 1.85 * gVStd
- '-------------------
- ' Set Tab Order...
- '-------------------
- txt(0).TabIndex = 0
- txt(1).TabIndex = 1
- txt(2).TabIndex = 2
- cbo(0).TabIndex = 3
- lst(0).TabIndex = 4
- frmEd.TabIndex = 5
- '---------------------------------
- ' Size & Position the Form...
- '---------------------------------
- '---Make form 2 std H units wider than most right control right side...
- TheWth% = (frmEd.Left + frmEd.width + (2 * gHStd) + (2 * gSysMet.wthFrame)) * gTwpsPerPxlX
- '---Make form 2 Std H units taller than lowest control bottom...
- TheHgt% = (frmEd.Top + frmEd.Height + gSysMet.hgtCapBar + (2 * gSysMet.hgtFrame) + 2 * gHStd) * gTwpsPerPxlY
- '---Center Form left to right...
- TheLft% = .5 * (Screen.width - TheWth%)
- '---Center form top to bottom (mostly toward top)...
- TheTop% = .25 * (Screen.Height - TheHgt%)
- '---Do It...
- Autosize.Move TheLft%, TheTop%, TheWth%, TheHgt%
- End Sub
- Sub PrimeCtls ()
- '---option button...
- opt(0).Value = -1
- '---combo box...
- cbo(0).AddItem "Aerospace"
- cbo(0).AddItem "Automotive"
- cbo(0).AddItem "Consumer"
- cbo(0).AddItem "Energy"
- cbo(0).ListIndex = 0
- '---listbox...
- lst(0).AddItem "Accounting"
- lst(0).AddItem "Advertising"
- lst(0).AddItem "Engineering"
- lst(0).AddItem "Management"
- lst(0).AddItem "Manufacturing"
- lst(0).ListIndex = 0
- End Sub
-